/*
 * Copyright (c) 2021. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
 * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
 * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
 * Vestibulum commodo. Ut rhoncus gravida arcu.
 */

package cn.edu.ntu.yyl.tool;

import cn.edu.ntu.yyl.service.OptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServlet;
import java.util.Map;
@Component
public class OptionReaderTool extends HttpServlet {
    @Autowired
    private OptionService optionService;
    public Map<String,Object>  ReadOptions(){
        //读取系统设置
        Map<String,Object> options;
        options = optionService.getalloption();
        for (Map.Entry<String, Object> entry : options.entrySet()) {
            if (entry.getValue()=="true"){
                Boolean b = true;
                entry.setValue(b);
            } else if (entry.getValue()=="false"){
                Boolean b = false;
                entry.setValue(b);
            } else if (entry.getValue()==""||entry.getValue()==null){
                Boolean b = false;
                entry.setValue(b);
            }
        }
        return options;
    }
}
